local M = {}

M.palette = {
    black = "#141414",
    black_alt = "#202020",
    red = "#df715a",
    green = "#729c67",
    yellow = "#ae903b",
    blue = "#5d94dc",
    magenta = "#c17ca2",
    cyan = "#1faba5",
    grey = "#a3a3a3",

    bright_black = "#464645",
    bright_red = "#ff8c6e",
    bright_green = "#8dc47f",
    bright_yellow = "#dbb545",
    bright_blue = "#6fbaff",
    bright_magenta = "#f49acc",
    bright_cyan = "#00d9d1",
    white = "#e2e1de",

    white_alt = "#e1d0ad",
}

M.config = {
    transparent_background = false,
    autoset = false,
}

function M.setup(config)
    for k, v in pairs(config) do
        M.config[k] = v
    end

    if config.autoset then
        vim.cmd.colorscheme("my_colors")
    end
end

function M:set_terminal_color()
    vim.g.terminal_ansi_colors = self.palette

    vim.g.terminal_color_0 = self.palette.black
    vim.g.terminal_color_1 = self.palette.red
    vim.g.terminal_color_2 = self.palette.green
    vim.g.terminal_color_3 = self.palette.yellow
    vim.g.terminal_color_4 = self.palette.blue
    vim.g.terminal_color_5 = self.palette.magenta
    vim.g.terminal_color_6 = self.palette.cyan
    vim.g.terminal_color_7 = self.palette.grey

    vim.g.terminal_color_8 = self.palette.bright_black
    vim.g.terminal_color_9 = self.palette.bright_red
    vim.g.terminal_color_10 = self.palette.bright_green
    vim.g.terminal_color_11 = self.palette.bright_yellow
    vim.g.terminal_color_12 = self.palette.bright_blue
    vim.g.terminal_color_13 = self.palette.bright_magenta
    vim.g.terminal_color_14 = self.palette.bright_cyan
    vim.g.terminal_color_15 = self.palette.white
end

return M
